#include "globals.h"

/* check if the value of the bit interval num[lbit]~num[rbit] is val */
int check_bit_interval(u32 num, int lbit, int rbit, u32 val)
{
    u32 lmask, rmask;

    lmask = ~0;
    rmask = ~0;

    lmask >>= 31 - lbit;
    rmask <<= rbit;

    return (((num & (lmask & rmask)) >> rbit) == val);
}
